package mjc.compiler;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;

public class PARAMETRES implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private ArrayList<Couple<String, DTYPE>> params;
	
	public PARAMETRES() {
		params = new ArrayList<Couple<String, DTYPE>>();
	}
	
	public void addParam(Couple<String, DTYPE> c) {
		try {
			params.add(c);
		} catch (NullPointerException e) {
			e.printStackTrace();
		}
	}
	
	public void addParam(DTYPE t) {
		try {
			params.add(new Couple<String, DTYPE>("", t));
		} catch (NullPointerException e) {
			e.printStackTrace();
		}
	}
	
	public ArrayList<Couple<String, DTYPE>> getParams() {
		return params;
	}
	
	public String toString() {
		Iterator<Couple<String, DTYPE>> i = params.iterator();
		String s = "";
		while(i.hasNext()) {
			Couple<String, DTYPE> c = i.next();
			s += "\n    PARAM "+c.fst+" : "+c.snd.getNom();
		}	
		return s;
	}
}
